Subject: Terminal WaitForAsync ScriptEvent[]
Date: 2020-04-22 22:14:13
From: justin.foster
Source: terminal-waitforasync-scriptevent[]
----------------------------------------------------------------------

This is probably something simple but I can't seem to find the answer. I am trying to use the WaitForAsync method with a TelnetTerminalControl. I am building my ScriptEvent array as per below and I get an error that it is not an array when I receive the callback.  How do I build an array of ScriptEvent?  Also, I am running in a headless mode, purely screen scraping, at what point should I consider all of a screen complete? Should I be polling for text or perhaps use tControl.Screen.GetRegionText?

Thank you in advance!


        private void Test()
        {
            ScriptEvent[] searchText = new ScriptEvent[]
            {
                 ScriptEvent.TextAtPosition("Test", 0, 0)
            };
            tControl.WaitForAsync(searchText, asyncWaitCompleted);
        }

       // Error = {"Unable to cast object of type 'ComponentPro.Net.Terminal.ScriptEvent' to type 'ComponentPro.Net.Terminal.ScriptEvent[]'."}
        private void asyncWaitCompleted(Object obj, System.ComponentModel.AsyncCompletedEventArgs eventArgs)
        {
            updateScreenText(DumpScreen());
        }

----------------------------------------------------------------------

Note: This question has been asked on the Q&A forum of Thang Dang's fraudulent ComponentPro brand
If you purchased anything from ComponentPro, you have been scammed. Contact the payment processor
who sold you the license and ask for your money back.

Back to ComponentPro Q&A Forum Index